<template>
  <van-cell class="articleItem" :to="`/article/${article.art_id}`">
    <!-- 标题插槽 -->
    <template slot="title">
      <div class="van-multi-ellipsis--l2 titleText">{{ article.title }}</div>
    </template>
    <!-- 描述插槽 -->
    <template slot="label">
      <div class="imgs" v-if="article.cover.type===3">
        <van-image
          v-for="(img, i) in article.cover.images" 
          :key="i"
          :src="img"
          fit="cover"
        />
      </div>
      <div class="labelText">
        <span>{{ article.aut_name }}</span>
        <span>{{ article.comm_count }}条评论</span>
        <span>{{ article.pubdate | relativeTime }}</span>
      </div>
    </template>
    <!-- 右侧图片插槽 -->
    <template  slot="default" v-if="article.cover.type === 1">
       <van-image
          :src="article.cover.images[0]"
          fit="cover"
        />
    </template>
  </van-cell>
</template>

<script>
export default {
  name: "ArticleItem",
  props: {
    article: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {};
  },
  methods: {},
  created() {},
};
</script>

<style lang="less" scoped>
.articleItem {
    .titleText {
        font-size: 32px;
        color:#393939;
        margin-bottom:15px;
    }
    ::v-deep .imgs {
        display:flex;
        .van-image {
            flex:1;
            height:146px;
            margin:4px;
            image{
                width: 100%;
                height: 100%;
            }
        }
        
    }

    ::v-deep .van-cell__title{
      flex:1;
      padding-right:10px;
    }

    ::v-deep .van-cell__value{
        // height: 146px;
        // width: 232px;
        flex:unset;
        .van-image{
            height: 146px;
            width: 232px;
        }
    }

    .labelText span{
        margin-right:15px;
    }
}
</style>